class InvitesController < ApplicationController

  before_filter :login_required, :find_user

  def new
    @invite = Invite.new
  end

  def create
    @invite = Invite.new(params[:invite])
    respond_to do |format|
      if @invite
        UserMailer.deliver_invite(:invite => @invite,
                                  :from   => current_user,
                                  :link   => signup_url)
        flash[:notice] = 'Invitation was sent.'
        format.html { redirect_to new_user_invite_url }
      else
        format.html { render :action => "new" }
      end
    end
  end

end
